const express = require('express');
const router = express.Router();
const $common = require('../utils/common');
const $db = require('../db');

// 列表
router.post('/list', async (req, res) => {
    let params = req.body; //参数
    /*
        查列表
    */
    let sql = `
        select 
            * 
        from 
            users 
        WHERE 
            userName LIKE '%${params.keyWord}%'
    `;
    $db.query(sql)
    .then(data=>{
        res.json({
            code:200,
            data:data
        })
    })
    .catch(err=>{
        console.log(err);
		res.json({
			code:'err',
			msg:'操作失败'
		});
	})
})

module.exports = router